-
Notifications
You must be signed in to change notification settings - Fork 81
feat: update public account retrieval #1591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
…lic-account-retrieval
| } | ||
| } | ||
|
|
||
| #[cfg(feature = "tonic")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? It does not seem to be needed in any of the other conversions
| // Builds an account that triggers the "too_many_assets" boolean | ||
| // flag when requested from the node. | ||
| fn build_test_faucets_and_account() -> anyhow::Result<Vec<Account>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, would be great to break this function into smaller ones to make this more readable. Alternatively (or maybe as a complement), would be great to add small comments within the function
| /// Given an id, return the proof for the account. | ||
| /// If the account also has public state, the details for it | ||
| /// will also be retrieve as part of the proof. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Given an id, return the proof for the account. | |
| /// If the account also has public state, the details for it | |
| /// will also be retrieve as part of the proof. | |
| /// Given an [`AccountId`], return the proof for the account. | |
| /// | |
| /// If the account also has public state, the details for it will also be retrieved as part of | |
| /// the proof. |
| info | ||
| } else { | ||
| let fetched_data = | ||
| self.sync_storage_maps(0_u32.into(), None, account_id).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need to implement pagination in GrpcClient::sync_storage_maps and GrpcClient::sync_storage_vaults, right?
| // Helper function to request extra details for an account. | ||
| // Keep in mind, this can potentially do **two** requests to the rpc endpoint. | ||
| // If the account has a non public state, it will simply return the first response. | ||
| // Otherwise it will request the RPC endpoint for the extra data for an account with public state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments look misplaced
| // Keep in mind, this can potentially do **two** requests to the rpc endpoint. | ||
| // If the account has a non public state, it will simply return the first response. | ||
| // Otherwise it will request the RPC endpoint for the extra data for an account with public state. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .get_account_proof(account_request) | ||
| .await | ||
| .map_err(|status| { | ||
| RpcError::from_grpc_error(NodeRpcClientEndpoint::GetAccountDetails, status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be renamed to something like NodeRpcClientEndpoint::GetAccount or something like that
Description:
Related issue: #1563.
There's a (currently open) PR for miden-node that unifies the "GetAccountDetails" and "GetAccountProofs endpoints" into a single endpoint "GetAccount". The goal of this PR is to adapt to said new endpoint, while preserving the actual NodeRpcClient trait API.
We will probably have to wait for said PR to be merged to be merged. Since I've encountered some versioning issues while working with this, so I'm currently using a local setup for this to work.
Also, something important is that the new protobuf structures have changed quite a bit, so there are probably some
parameters I might've missed or that we should decide on how to handle them.
Tasks Left: